import React, { useState, useEffect } from "react";
function Effect() {
 const [count, setCount] = useState(0);
  useEffect(() => {
    const id = setInterval(() => {
      setCount((precount)=>{
        return precount+1
      }); 
    }, 1000);
    return () => clearInterval(id);
  }, []); 
  return (
    <div>
      <h4>姓名：gqg</h4>
      <h4>年龄：18</h4>
      <h4>次数：{count}</h4>
    </div>
  );
}
export default Effect;
